package com.woniuxy.yogaapp.mapper;/*
									*@author：源
									*@date:17:00:00
									*@descripion
									*/

import com.woniuxy.yogaapp.dto.EvaluateDto;
import com.woniuxy.yogaapp.pojo.Appraise;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface AppraiseMapper {
	// 插入评论，返回id
	@Insert("insert into appraise (apsender,aprec,mes,state,aptime,snickname) values(#{apsender},#{aprec},#{mes},#{state},#{aptime},#{snickname})")
	@Options(useGeneratedKeys = true, keyProperty = "apid", keyColumn = "apid")

	public int insertApparise(EvaluateDto evaluateDto);

	// 插入apid
	@Update("update detailorder set apid=#{apid},state=7 where detailoid=#{detailoid}")
	public int insertApid(EvaluateDto evaluateDto);

	// 根据aprec查询评论
	@Select("select * from appraise where aprec=#{aprec} and flag=0")
	public List<Appraise> findAppraise(int aprec);
	//根据APID更新评论
	@Update("update appraise set mes=#{mes},state=#{state} where apid=#{apid}")
	public int updateAppraise(EvaluateDto evaluateDto);

}
